home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1599 / 1402 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  3.8 KB

  1. From: Michael Smith <miff@apanix.apana.org.au>
  2. Subject: Opening files so that no cr/lf translation is done.
  3. Date: Tue, 17 May 1994 22:04:55 +0930 (CST)
  4.  
  5. This is a bit of an interesting one - certainly it's been giving me my
  6. fair share of migraine problems.
  7.  
  8. I made a rash (in restrospect) announcement about the Taylor UUCP
  9. package a short while ago, let me qualify the state of things now :
  10.  
  11. uucico works fine, with the exception of the ability to detatch from
  12. the controlling terminal.  I assume this has something to do with the
  13. differences between "normal" fork() and the MiNT fork() - this is not
  14. a terrible problem, although it makes it (AFAIK) impossible for 
  15. uucico to receive SIGHUP from the modem, or to put uuxqt in the
  16. background.
  17.  
  18. uuxqt does not.
  19.  
  20. In particular, compressed newsbatches get mangled.
  21.  
  22. This had me stumped for some time - particularly because the 'od' in
  23. the shu194st.zoo archive on atari.archive has the same problem : so I 
  24. have two files, of different size, that 'od' to the same file.
  25.  
  26. Jens - if you're reading this, both thanks _and_ flames - can you fix
  27. it please? 
  28.  
  29. Now, I don't know how many of you have tangled with the innards of
  30. Taylor, but it's not hugely pretty - everything is abstracted to the 
  31. n'th degree, which probably makes it _great_ for porting, but learning
  32. it is no fun at all 8(
  33.  
  34. I have verified that the rnews I am using works (feeding it a compressed
  35. newsbatch results in it being neatly stashed where it should (ownership
  36. is wrong, ends up as uucp not news, despite sticky bit on /bin/rnews,
  37. but that's life 8( ) and I can verify that it is correct with 
  38. tail +2 <newsbatch> |zcat |less
  39.  
  40. However, if I use uuxqt to invoke rnews, things don't work out.
  41.  
  42. This is what it does : after parsing the X. files and taking appropriate
  43. security precautions, this call is made... (uuxqt.c)
  44.  
  45.   if (! fsysdep_execute (qsys,
  46.      zQuser == NULL ? (const char *) "uucp" : zQuser,
  47.      (const char **) azQargs, zfullcmd, zQinput,
  48.      zoutput, fshell, iQlock_seq, &zerror, &ftemp))
  49.  
  50. where the arguments of interest are zQinput and zoutput. (char *filename)
  51.  
  52. In fsysdep_execute() zQinput becomes zinput, and we have :
  53.  
  54.   if (zinput != NULL)
  55.     {
  56.       aidescs[0] = open ((char *) zinput, O_RDONLY | O_NOCTTY, 0);
  57.       if (aidescs[0] < 0)
  58.     {
  59.       ulog (LOG_ERROR, "open (%s): %s", zinput, strerror (errno));
  60.       ferr = TRUE;
  61.     }
  62.       else if (fcntl (aidescs[0], F_SETFD,
  63.               fcntl (aidescs[0], F_GETFD, 0) | FD_CLOEXEC) < 0)
  64.     {
  65.       ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno));
  66.       ferr = TRUE;
  67.     }    
  68.     }
  69.  
  70.  
  71. and for zoutput :
  72.  
  73.   if (! ferr && zoutput != NULL)
  74.     {
  75.       aidescs[1] = creat ((char *) zoutput, IPRIVATE_FILE_MODE);
  76.       if (aidescs[1] < 0)
  77.     {
  78.       ulog (LOG_ERROR, "creat (%s): %s", zoutput, strerror (errno));
  79.       *pftemp = TRUE;
  80.       ferr = TRUE;
  81.     }
  82.       else if (fcntl (aidescs[1], F_SETFD,
  83.               fcntl (aidescs[1], F_GETFD, 0) | FD_CLOEXEC) < 0)
  84.     {
  85.       ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno));
  86.       ferr = TRUE;
  87.     }    
  88.     }
  89.  
  90.  
  91. Zoutput is not very important for rnews, but it may well be for other
  92. applications.
  93.  
  94. I'm not going to go further - there's too much to wade through, but in
  95. brief : this routine calls ixsspawn() which takes, amongst many
  96. other arguments, the filedescriptors in aidescs[0] and [1], which are
  97. used as stdin and stdout for the command.
  98.  
  99. Somewhere along the line here, translation occurs... 
  100. I have looked at open.c in the pl44 mintlibs, but the nondiscussion
  101. of CRMOD has left me none the wiser.
  102.  
  103. If anyone has a suggestion, I'm open to ideas...
  104.  
  105. -- 
  106. # mike smith : miff@apanix.apana.org.au - Silicon grease monkey        #
  107. # "The question 'why are the fundamental laws of nature mathematical'  #
  108. # then invites the trivial response 'because we define as fundamental  #
  109. # those laws which are mathematical'". Paul Davies, _The_Mind_of_God_. #
  110.